import 'package:flutter/material.dart';
import 'infinite_test.dart';
import 'marquee_test.dart';
import 'simple_test.dart';
import 'stagger_test.dart';

class AnimateTest extends StatefulWidget {
  @override
  _AnimateTestState createState() => _AnimateTestState();
}

class _AnimateTestState extends State<AnimateTest> {
  // 标题
  Widget _titleBuilder(String title) {
    final BorderSide thinBorder = BorderSide(
      width: 2,
      color: Theme.of(context).primaryColor,
    );

    final BorderSide boldBorder = BorderSide(
      width: 6,
      color: Theme.of(context).primaryColor,
    );

    return Container(
      height: 40,
      margin: EdgeInsets.symmetric(vertical: 5, horizontal: 8),
      padding: EdgeInsets.only(left: 6),
      alignment: Alignment.centerLeft,
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
          top: thinBorder,
          right: thinBorder,
          bottom: thinBorder,
          left: boldBorder,
        ),
      ),
      child: Text(title),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('动画'),
        centerTitle: true,
      ),
      body: ListView(
        children: [
          _titleBuilder('简单动画'),
          SimpleTest(),
          _titleBuilder('循环动画'),
          InfiniteTest(),
          _titleBuilder('交错动画'),
          StaggerTest(),
          _titleBuilder('Marquee (简单地用列表实现，其实和动画关系不大)'),
          MarqueeTest(),
        ],
      ),
    );
  }
}
